#pragma once

#include <stdio.h>
#include <windows.h>
#include <dinput.h>
#include <conio.h>
#include <string>
#include <fstream>
#include <cmath>

#include "winmain.h"
#include "globals.h"
#include "globals2.h"
#include "Object.h"
#include "Unit.h"
#include "Env.h"
#include "Misc.h"

using namespace std;

void loadUIGraphics(int startingX, int startingY, int startingX2, int startingY2, int startingX3, int startingY3, int startingX4, int startingY4, 
					int startingX5, int startingY5) {
	list<BUTTON>::iterator iter;
	TEXTMETRICA font;
	standardFont->GetTextMetricsA(&font);
	BUTTON tempButton;

	//-----------------------------------------------------------//
	//					Loading Menu Graphics
	//-----------------------------------------------------------//
	tempButton.x = startingX;
	tempButton.y = startingY;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = NEW_MAP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonNEW.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = OPEN_MAP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonOPEN.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = SAVE_MAP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonSAVE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = SAVE_MAP_AS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonSAVEAS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = UNIT_OBJECTS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUNITS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = ENV_OBJECTS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonENV.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = MISC_OBJECTS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMISC.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	iter = MenuButtons.begin();
	tempButton.x = iter->x + iter->w;
	tempButton.y = iter->y;
	tempButton.w = MENU_BUTTON_WIDTH;
	tempButton.h = MENU_BUTTON_HEIGHT;
	tempButton.bCmd = LIGHT_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonLIGHT.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MenuButtons.push_front(tempButton);

	//-----------------------------------------------------------//
	//					Loading Unit Button Graphics
	//-----------------------------------------------------------//
	iter = UnitButtons.begin();
	tempButton.x = startingX2;
	tempButton.y = startingY2;
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLACE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLACE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (iter->h*2);
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = DELETE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDELETE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = GROUND_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonGROUNDY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = PLAYER_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLAYERY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = UnitButtons.begin();
	tempButton.x = iter->x + 120;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);
	
	//-----------------------------------------------------------
	iter = UnitButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = UnitButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = UnitButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LEVEL;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_VALUE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LEVEL;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_VALUE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = UnitButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_CAN_MOVE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_STANCE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_GROUP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = UnitButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_CAN_MOVE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_STANCE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	iter = UnitButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + font.tmHeight;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_GROUP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitButtons.push_front(tempButton);

	//-----------------------------------------------------------//
	//					Loading Env Button Graphics
	//-----------------------------------------------------------//
	iter = EnvButtons.begin();
	tempButton.x = startingX2;
	tempButton.y = startingY2;
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLACE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLACE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (iter->h*2);
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = DELETE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDELETE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = GROUND_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonGROUNDY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = PLAYER_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLAYERY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = EnvButtons.begin();
	tempButton.x = iter->x + 120;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);
	
	//-----------------------------------------------------------
	iter = EnvButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = EnvButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = EnvButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_VALUE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = EnvButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	iter = EnvButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_VALUE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvButtons.push_front(tempButton);

	//-----------------------------------------------------------//
	//					Loading Misc Button Graphics
	//-----------------------------------------------------------//
	iter = MiscButtons.begin();
	tempButton.x = startingX2;
	tempButton.y = startingY2;
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLACE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLACE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (iter->h*2);
	tempButton.w = SUBMENU_BUTTON_WIDTH*4;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = DELETE_OBJECT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDELETE.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = GROUND_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonGROUNDY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + (int)(iter->h*1.5);
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = PLAYER_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLAYERY.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = MiscButtons.begin();
	tempButton.x = iter->x + 120;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LOCATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);
	
	//-----------------------------------------------------------
	iter = MiscButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ROTATION_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = MiscButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SCALE_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = MiscButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_PURPOSE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_HRADIUS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_ORDER;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH + 30;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ALIGNMENT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_PURPOSE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_HRADIUS;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_ORDER;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = MiscButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_GROUP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_SOUNDFILE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = MiscButtons.back().y + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_GROUP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	iter = MiscButtons.begin();
	tempButton.x = iter->x + 100;
	tempButton.y = iter->y + iter->h + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_SOUNDFILE;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscButtons.push_front(tempButton);

	//-----------------------------------------------------------//
	//					Loading Light Button Graphics
	//-----------------------------------------------------------//
	iter = LightButtons.begin();
	tempButton.x = startingX2;
	tempButton.y = startingY2 + font.tmHeight + 2;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIR_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIR_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIR_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIR_X;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIR_Y;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIR_Z;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);
	
	//-----------------------------------------------------------
	iter = LightButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIF_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIF_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_DIF_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIF_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIF_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_DIF_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = LightButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_SPE_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_SPE_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_SPE_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_SPE_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_SPE_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_SPE_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = LightButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_AMB_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_AMB_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = PLUS_LIGHT_AMB_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonPLUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x + SUBBUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_AMB_R;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_AMB_G;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	iter = LightButtons.begin();
	tempButton.x = iter->x;
	tempButton.y = iter->y + iter->w + 5;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = MINUS_LIGHT_AMB_B;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonMINUS.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	//-----------------------------------------------------------
	iter = LightButtons.begin();
	tempButton.x = iter->x + BUTTON_GAP_WIDTH;
	tempButton.y = LightButtons.back().y;
	tempButton.w = SUBMENU_BUTTON2_WIDTH;
	tempButton.h = SUBMENU_BUTTON2_HEIGHT;
	tempButton.bCmd = RESET_LIGHT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonRESET.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	LightButtons.push_front(tempButton);

	//-----------------------------------------------------------//
	//				Loading Model Buttons/Icons Graphics
	//-----------------------------------------------------------//
	tempButton.x = startingX3 + (int)(MODEL_ICON_WIDTH/2) - (int)(SUBMENU_BUTTON_WIDTH/2);
	tempButton.y = startingY3;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_UP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitSideListButtons.push_back(tempButton);

	list<Unit>::iterator unitIter = UnitObjects.begin();
	if(UnitObjects.size() >= MODEL_ICONS_VISIBLE) {
		for(int i=0; i<MODEL_ICONS_VISIBLE; i++) {
			tempButton.x = startingX3;
			tempButton.y = UnitSideListButtons.back().y + UnitSideListButtons.back().h;
			tempButton.w = MODEL_ICON_WIDTH;
			tempButton.h = MODEL_ICON_HEIGHT;
			tempButton.bCmd = MODEL_ICON_BUTTON;
			D3DXCreateTextureFromFileEx(pd3dDevice, unitIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
										D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
			UnitSideListButtons.push_back(tempButton);
			unitIter++;
		}
	} else if(UnitObjects.size() < MODEL_ICONS_VISIBLE) {
		int limit = UnitObjects.size();
		for(int i=0; i!=limit; i++) {
			tempButton.x = startingX3;
			tempButton.y = UnitSideListButtons.back().y + UnitSideListButtons.back().h;
			tempButton.w = MODEL_ICON_WIDTH;
			tempButton.h = MODEL_ICON_HEIGHT;
			tempButton.bCmd = MODEL_ICON_BUTTON;
			D3DXCreateTextureFromFileEx(pd3dDevice, unitIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
										D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
			UnitSideListButtons.push_back(tempButton);
			unitIter++;
		}
	} else if(UnitObjects.empty()) {
	}

	tempButton.x = UnitSideListButtons.front().x;
	tempButton.y = UnitSideListButtons.back().y + UnitSideListButtons.back().h;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_DOWN;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDOWN.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	UnitSideListButtons.push_back(tempButton);

	//-----------------------------------------------------------
	tempButton.x = startingX3 + (int)(MODEL_ICON_WIDTH/2) - (int)(SUBMENU_BUTTON_WIDTH/2);
	tempButton.y = startingY3;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_UP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvSideListButtons.push_back(tempButton);

	list<Env>::iterator envIter = EnvObjects.begin();
	if(EnvObjects.size() >= MODEL_ICONS_VISIBLE) {
		for(int i=0; i<MODEL_ICONS_VISIBLE; i++) {
			tempButton.x = startingX3;
			tempButton.y = EnvSideListButtons.back().y + EnvSideListButtons.back().h;
			tempButton.w = MODEL_ICON_WIDTH;
			tempButton.h = MODEL_ICON_HEIGHT;
			tempButton.bCmd = MODEL_ICON_BUTTON;
			D3DXCreateTextureFromFileEx(pd3dDevice, envIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
										D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
			EnvSideListButtons.push_back(tempButton);
			envIter++;
		}
	} else if(EnvObjects.size() < MODEL_ICONS_VISIBLE) {
		int limit = EnvObjects.size();
		for(int i=0; i!=limit; i++) {
			tempButton.x = startingX3;
			tempButton.y = EnvSideListButtons.back().y + EnvSideListButtons.back().h;
			tempButton.w = MODEL_ICON_WIDTH;
			tempButton.h = MODEL_ICON_HEIGHT;
			tempButton.bCmd = MODEL_ICON_BUTTON;
			D3DXCreateTextureFromFileEx(pd3dDevice, envIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
										D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
			EnvSideListButtons.push_back(tempButton);
			envIter++;
		}
	} else if(EnvObjects.empty()) {
	}

	tempButton.x = EnvSideListButtons.front().x;
	tempButton.y = EnvSideListButtons.back().y + EnvSideListButtons.back().h;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_DOWN;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDOWN.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	EnvSideListButtons.push_back(tempButton);

	//-----------------------------------------------------------
	tempButton.x = startingX3 + (int)(MODEL_ICON_WIDTH/2) - (int)(SUBMENU_BUTTON_WIDTH/2);
	tempButton.y = startingY3;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_UP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscSideListButtons.push_back(tempButton);

	list<Misc>::iterator miscIter = MiscObjects.begin();
	if(!MiscObjects.empty()) {
		if(MiscObjects.size() >= MODEL_ICONS_VISIBLE) {
			for(int i=0; i<MODEL_ICONS_VISIBLE; i++) {
				tempButton.x = startingX3;
				tempButton.y = MiscSideListButtons.back().y + MiscSideListButtons.back().h;
				tempButton.w = MODEL_ICON_WIDTH;
				tempButton.h = MODEL_ICON_HEIGHT;
				tempButton.bCmd = MODEL_ICON_BUTTON;
				D3DXCreateTextureFromFileEx(pd3dDevice, miscIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
											D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
				MiscSideListButtons.push_back(tempButton);
				miscIter++;
			}
		} else if(MiscObjects.size() < MODEL_ICONS_VISIBLE) {
			for(int i=0; i!=MiscObjects.size(); i++) {
				tempButton.x = startingX3;
				tempButton.y = MiscSideListButtons.back().y + MiscSideListButtons.back().h;
				tempButton.w = MODEL_ICON_WIDTH;
				tempButton.h = MODEL_ICON_HEIGHT;
				tempButton.bCmd = MODEL_ICON_BUTTON;
				D3DXCreateTextureFromFileEx(pd3dDevice, miscIter->getIconLocation().c_str(), tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
											D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
				MiscSideListButtons.push_back(tempButton);
				miscIter++;
			}
		} 
	}

	tempButton.x = MiscSideListButtons.front().x;
	tempButton.y = MiscSideListButtons.back().y + MiscSideListButtons.back().h;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_DOWN;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDOWN.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	MiscSideListButtons.push_back(tempButton);

	//-----------------------------------------------------------//
	//				Loading Display On/Off Switches
	//-----------------------------------------------------------//
	tempButton.x = startingX4;
	tempButton.y = startingY4;
	tempButton.w = MODEL_ICON_WIDTH;
	tempButton.h = MODEL_ICON_HEIGHT;
	tempButton.bCmd = DISPLAY_UNIT;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/DisplayUnitOnSwitch.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	DisplayOnOffSwitch.push_back(tempButton);

	tempButton.x = DisplayOnOffSwitch.back().x;
	tempButton.y = DisplayOnOffSwitch.back().y + DisplayOnOffSwitch.back().h;
	tempButton.w = MODEL_ICON_WIDTH;
	tempButton.h = MODEL_ICON_HEIGHT;
	tempButton.bCmd = DISPLAY_ENV;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/DisplayEnvOnSwitch.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	DisplayOnOffSwitch.push_back(tempButton);

	tempButton.x = DisplayOnOffSwitch.back().x;
	tempButton.y = DisplayOnOffSwitch.back().y + DisplayOnOffSwitch.back().h;
	tempButton.w = MODEL_ICON_WIDTH;
	tempButton.h = MODEL_ICON_HEIGHT;
	tempButton.bCmd = DISPLAY_MISC;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/DisplayMiscOnSwitch.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	DisplayOnOffSwitch.push_back(tempButton);

	tempButton.x = DisplayOnOffSwitch.back().x;
	tempButton.y = DisplayOnOffSwitch.back().y + DisplayOnOffSwitch.back().h;
	tempButton.w = MODEL_ICON_WIDTH;
	tempButton.h = MODEL_ICON_HEIGHT;
	tempButton.bCmd = DISPLAY_MAP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/DisplayMapOnSwitch.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	DisplayOnOffSwitch.push_back(tempButton);

	//-----------------------------------------------------------//
	//					Loading Open Map Buttons
	//-----------------------------------------------------------//
	tempButton.x = (startingX5 + (OPEN_MAP_BOX_WIDTH/2)) - (SUBMENU_BUTTON_WIDTH);
	tempButton.y = startingY5 + 50;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_UP;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	OpenMapButtons.push_back(tempButton);

	if(!OpenFilesList.empty()) {
		if(OpenFilesList.size() >= OPEN_MAP_NUM_DISPLAY) {
			for(int i=0; i<OPEN_MAP_NUM_DISPLAY; i++) {
				tempButton.x = startingX5;
				tempButton.y = OpenMapButtons.back().y + OpenMapButtons.back().h;
				tempButton.w = OPEN_MAP_BOX_WIDTH;
				tempButton.h = font.tmHeight;
				tempButton.bCmd = OPEN_MAP_ICON_BUTTON;
				D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
											D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
				OpenMapButtons.push_back(tempButton);
			}
		} else if(OpenFilesList.size() < OPEN_MAP_NUM_DISPLAY) {
			for(int i=0; i!=OpenFilesList.size(); i++) {
				tempButton.x = startingX5;
				tempButton.y = OpenMapButtons.back().y + OpenMapButtons.back().h;
				tempButton.w = OPEN_MAP_BOX_WIDTH;
				tempButton.h = font.tmHeight;
				tempButton.bCmd = OPEN_MAP_ICON_BUTTON;
				D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonUP.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
											D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
				OpenMapButtons.push_back(tempButton);
			}
		}
	}

	tempButton.x = OpenMapButtons.front().x;
	tempButton.y = OpenMapButtons.back().y + OpenMapButtons.back().h;
	tempButton.w = SUBMENU_BUTTON_WIDTH;
	tempButton.h = SUBMENU_BUTTON_HEIGHT;
	tempButton.bCmd = SCROLL_DOWN;
	D3DXCreateTextureFromFileEx(pd3dDevice, "Graphics/Editor Icons/ButtonDOWN.png", tempButton.w, tempButton.h, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
								D3DPOOL_DEFAULT,SPRITE_FILTER, SPRITE_MIP_FILTER, BUTTON_TRANSPARENCY, NULL, NULL, &tempButton.pic);
	OpenMapButtons.push_back(tempButton);
}